<!DOCTYPE html>
<html>
<script src="/js-test-resources/js-test.js"></script>
<body>
<p id="description"></p>
<p id="console"></p>
<iframe src="data:text/html,"></iframe>
<script>
window.jsTestIsAsync = true;
if (document.location.hostname == '127.0.0.1') {
    document.location.hostname = 'subdomain.example.test';
} else {
    description('Tests that isolated worlds do not allow cross-origin frame access');

    if (window.testRunner) {
        window.addEventListener('message', function(event) {
            var message = JSON.parse(event.data);
            switch (message.type) {
            case 'debug':
                debug(message.message);
                break;
            case 'finish':
                finishJSTest();
                break;
            }
        });

        window.onload = function() {
          testRunner.setIsolatedWorldInfo(2, 'chrome-extension://123', null);
          var iframe = document.getElementsByTagName('iframe')[0];
          iframe.focus();
          document.domain = 'example.test';
          iframe.src = 'http://subdomain.example.test:8000/security/resources/cross-frame-iframe-for-parent-isolated-world.html';
        }
    } else {
        testFailed('Test depends on LayoutTestController and must be run by DRT');
    }
}
</script>
</body>
</html>
